unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ADODB, FHisDataService, FHisADODataService, DBClient,
  FHisDataSet, StdCtrls, FMemo, Mask, DBCtrls, FDBEdit, FDBMemo;

type
  TForm1 = class(TForm)
    FHisDataSet1: TFHisDataSet;
    HisADODataService1: THisADODataService;
    ADOConnection1: TADOConnection;
    FDBEdit1: TFDBEdit;
    FMemo1: TFMemo;
    Button1: TButton;
    Button2: TButton;
    DataSource1: TDataSource;
    DBMemo1: TDBMemo;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure HisADODataService1GetSQLEvent(Sender: TObject; ASQL: String);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  with FHisDataSet1 do
  begin
    if Active then Close;
    SQL.Clear;
    SQL.Add('SELECT * FROM ZD_RYGK WHERE FLAG=0 and BM=''111'' ');
    Open;
  end;

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  FHisDataSet1.ApplyUpdates('ZD_RYGK','BM;FLAG');
end;

procedure TForm1.HisADODataService1GetSQLEvent(Sender: TObject;
  ASQL: String);
begin
  FMemo1.Lines.Add(ASQL);
end;

end.
